<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
	</body>
	<script type="text/javascript">
//		1.创建ajax对象
		var xhr = new XMLHttpRequest();
//		2.监听函数
		xhr.onreadystatechange = function(){
			if(xhr.readyState==4){
//				5.拿过来的数据
				var data = JSON.parse(xhr.responseText);
				console.log(data.body)
				var str = "";
				data.body.forEach(function(item){
					var imgs = item.imgSrc
					str += `
						<img src="http://localhost:8081${imgs}"/>
					`;
				})
				document.getElementsByTagName("body")[0].innerHTML = str;
			}
			
		}
//		3.建立连接
		xhr.open("GET","http://localhost:8081/home/swiper")
//		4.发送请求
		xhr.send(null)
		
	</script>
</html>
